
{% extends "../templates/ajax/main_content_base.html" %}
{% block intro %}{% endblock %}
{% block page_name %}edit_password{% endblock %}
{% block content %}

<div class="content-box">
	<div class="content-box-header">
		<h3>用户注册</h3>
	</div>
	<!-- End .content-box-header -->

	<div class="content-box-content">

		<div class="tab-content default-tab">

			<h4></h4>
			<form id="edit-user-form" action="edit_password" method="post">

				<fieldset>
					<!-- Set class to "column-left" or "column-right" on fieldsets to divide the form into columns -->

					<p>
						<label>学号</label>
						 <input
							class="text-input small-input" type="text" readonly id="student_id"
							name="student_id" value="{{user.student_id}}"/>
						<!-- Classes for input-notification: success, error, information, attention -->
						<br />
						<small>您的学号</small>
					</p>
					<p>
						<label>原密码</label>
						 <input
							class="text-input small-input required" type="password" id="old_password"
							name="old_password" />
						<!-- Classes for input-notification: success, error, information, attention -->
						<br />
						<small>您的密码</small>
					</p>
					<p>
						<label>新密码</label>
						 <input
							class="text-input small-input required" type="password" id="password_1"
							name="new_password" />
						<!-- Classes for input-notification: success, error, information, attention -->
						<br />
						<small>您的密码</small>
					</p>
					
					<p>
						<label>重复密码</label>
						 <input
							class="text-input small-input required" type="password" id="password_2" equalTo="#password_1"
							name="password_2" />
						<!-- Classes for input-notification: success, error, information, attention -->
						<br />
						<small>请重复输入密码</small>
					</p>
					
					<p>
						<input class="button" type="submit" value="修改" />
					</p>

				</fieldset>

				<div class="clear"></div>
				<!-- End .clear -->

			</form>

		</div>
		<!-- End #tab3 -->

	</div>
	<!-- End .content-box-content -->

</div>
<!-- End .content-box -->
<script type="text/javascript" >
$('#edit-user-form').validate();

$('#edit-user-form').ajaxForm({
    // dataType identifies the expected content type of the server response
    dataType: 'json',
    // success identifies the function to invoke when the server response
    // has been received
    success:function(json)
    {
    	if(json.error)
    		{
    			if(json.error_type=="WrongPassword")
    			
    				Boxy.alert("原密码错误，请检查您的信息", function() {}, {title: '错误'});
    			else
    				Boxy.alert("密码修改错误，请检查您的信息"+json.error_type+json.error, function() {}, {title: '错误'});
    		}
    	else
    		Boxy.alert("密码修改成功", function() {
    			$('#main-content').load('edit_password')
    		}, {title: '成功'});
    }
});
</script>


{% endblock %}
